home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2003 November / PCWK1103B.iso / DesignCAD 3D Max PLUS trial 30 / DATA1.CAB / Example_Files / Sample_Macros / Check Layer Status.d3m < prev    next >
Encoding:
Text File  |  2003-09-29  |  1.7 KB  |  53 lines

  1. ' This BasicCAD program determines the status of layers within a DesignCAD drawing.
  2. '
  3. ' It uses a simple for/next loop to iterate through the first 10 layers, (1-10, not zero).
  4. ' On each layer it uses integer division to determine the layer's status, then displays
  5. ' a message with the results.  If that layer is named, the name is also returned.
  6. '
  7. ' Since SYS$93 returns the name of the current layer, the origional current layer number 
  8. ' must be stored before the loop starts, and reset once we're done.
  9. '
  10. ' Change the value of the variable Count to make the program work with more or less layers.
  11. '
  12. Precision 0
  13. Count = 10    
  14. ' Get the Current Layer Before Starting the Loop
  15. Current = Sys(3)
  16. '
  17. ' Loop for Layers 1-10
  18. for a = 1 to Count
  19. ' Set the Current Layer to a
  20.     Sys(3) = a
  21. ' Setup Default Values
  22.     visible$ = "not visible"
  23.     edt$ = "not editable"
  24.     ent$ = "contains no entities"
  25. Y=LAYER(a)                ' Returns 0-15
  26. if ODD(Y\2)=1 then            ' Layer is visible, Results 2, 3, 6, 7, 14, or 15
  27.     visible$ = "visible"
  28. endif
  29. if ODD(y\4)=1 then            ' Layer is Editable, Results 6, 7, 14, or 15
  30.     edt$ = "editable"
  31. endif
  32. if ODD(y)=1 then            ' Layer Contains Entities, Results 1, 3, 7, or 15
  33.     ent$ = "contains entities"
  34. endif
  35. ' Check for Layer Name
  36. if SYS$(93) = "" then
  37.     name$ = "and has no name assigned."
  38. else
  39.     name$ = "and is named",Sys$(93),"."
  40. endif
  41. ' Display Results
  42.     Message "Layer ",a," is",visible$,",",edt$,",",ent$,",",name$
  43. if a = Current then
  44.     Message "Layer ",a," is also the Current Layer . . ."
  45. endif
  46. ' Done with this layer, get the next one, loop back to the For statement
  47.     next a
  48. ' Done with all Layers in Count
  49.     Message "Done. ",Count," Layers Checked."
  50. ' Set current Layer back to origional value
  51.     Sys(3) = Current
  52. End
  53.